function init() {
  chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    console.log(request, sender, sendResponse);
    sendResponse("我收到了你的消息！");
  });
}

function send(data) {
  return new Promise((resolve) => {
    chrome.runtime.sendMessage({ type: "page_request", data }, (res) => {
      resolve(res);
    });
  });
}

export default {
  init,
  send,
};
